Skip to content

extensions/khr: Add VK_KHR_pipeline_binary extension#944

Open
MarijnS95 wants to merge 1 commit into
masterfrom
khr-pipeline-binary
Open

extensions/khr: Add VK_KHR_pipeline_binary extension#944
MarijnS95 wants to merge 1 commit into
masterfrom
khr-pipeline-binary

Conversation

@MarijnS95

@MarijnS95 MarijnS95 commented Sep 19, 2024

Copy link
Copy Markdown
Collaborator

No description provided.

@MarijnS95 MarijnS95 marked this pull request as draft September 19, 2024 21:42
@MarijnS95 MarijnS95 force-pushed the khr-pipeline-binary branch 2 times, most recently from e46d73b to a97aa7d Compare September 26, 2024 10:01
@MarijnS95 MarijnS95 force-pushed the khr-pipeline-binary branch from a97aa7d to 0b62cd5 Compare December 2, 2024 12:04
@MarijnS95

MarijnS95 commented Dec 2, 2024

Copy link
Copy Markdown
Collaborator Author

Our no_std build complains:

error[E0412]: cannot find type `Vec` in this scope
  --> ash/src/extensions/khr/pipeline_binary.rs:66:19
   |
66 |     ) -> VkResult<Vec<u8>> {
   |                   ^^^ not found in this scope
   |
help: consider importing this struct
   |
3  | use alloc::vec::Vec;
   |

It's quite unfortunate that the clippy::std_instead_of_alloc lint didn't warn that Vec from the prelude is in std (this lint only triggers if use std::vec::Vec is explicitly imported). CC @i509VCB who landed this feature, I haven't found an upstream tracking issue but maybe you know about this?

@MarijnS95 MarijnS95 force-pushed the khr-pipeline-binary branch 2 times, most recently from 69cf5ec to dd71365 Compare December 2, 2024 13:12
Comment thread ash/src/extensions/khr/pipeline_binary.rs Outdated
@MarijnS95 MarijnS95 marked this pull request as ready for review December 2, 2024 13:22
@MarijnS95 MarijnS95 requested a review from Ralith December 2, 2024 13:22
@MarijnS95 MarijnS95 added this to the Ash 0.39 with Vulkan 1.4 milestone Dec 3, 2024
@MarijnS95 MarijnS95 force-pushed the khr-pipeline-binary branch 6 times, most recently from 19c3eb3 to 7be4595 Compare December 6, 2024 14:50
Comment thread ash/src/extensions/khr/pipeline_binary.rs Outdated
Comment thread ash/src/prelude.rs Outdated
Comment thread ash/src/prelude.rs Outdated
Comment thread ash/src/prelude.rs Outdated
Comment thread ash/src/prelude.rs Outdated
@MarijnS95 MarijnS95 force-pushed the khr-pipeline-binary branch from 7be4595 to 83d7496 Compare May 4, 2026 13:23
@MarijnS95 MarijnS95 requested a review from Ralith May 4, 2026 13:29
Comment thread ash/src/lib.rs
/// Calls `f` at most twice until it does not return [`vk::Result::ERROR_NOT_ENOUGH_SPACE_KHR`],
/// ensuring all available binary data has been read into the vector.
///
/// The first call happens with a [`Vec`] of capacity `4096`. If this is not adequate, `f` is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a blocker, but I'd like to see some sort of reference for why we think 4KiB in particular makes sense here rather than, say, 128B, or 1MiB.

Comment thread ash/src/lib.rs
count > data.capacity(),
"Implementation should have updated the value to be higher than the initial request"
);
data.reserve(count);

@Ralith Ralith May 4, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vec::reserve takes the number of additional bytes, so this will over-allocate. We should pass count - data.capacity() (probably via a temporary to keep borrowck happy).

Comment thread ash/src/lib.rs
count > data.capacity(),
"Implementation should have updated the value to be higher than the initial request"
);
data.reserve(count);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We don't expect to reallocate this any further, so Vec::reserve_exact would be a little better.

Comment thread ash/src/prelude.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants